package torque.generated;


import java.math.BigDecimal;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;

import org.apache.commons.lang.ObjectUtils;
import org.apache.torque.TorqueException;
import org.apache.torque.map.TableMap;
import org.apache.torque.om.BaseObject;
import org.apache.torque.om.ComboKey;
import org.apache.torque.om.DateKey;
import org.apache.torque.om.NumberKey;
import org.apache.torque.om.ObjectKey;
import org.apache.torque.om.SimpleKey;
import org.apache.torque.om.StringKey;
import org.apache.torque.om.Persistent;
import org.apache.torque.util.Criteria;
import org.apache.torque.util.Transaction;





/**
 * 
 *
 * This class was autogenerated by Torque on:
 *
 * [Wed Oct 12 14:08:00 CEST 2011]
 *
 * You should not use this class directly.  It should not even be
 * extended all references should be to Objet
 */
public abstract class BaseObjet extends BaseObject
{
    /** Serial version */
    private static final long serialVersionUID = 1318421280375L;

    /** The Peer class */
    private static final ObjetPeer peer =
        new ObjetPeer();


    /** The value for the nomobjet field */
    private String nomobjet;

    /** The value for the description field */
    private String description;

    /** The value for the type field */
    private String type;

    /** The value for the duree field */
    private int duree;

    /** The value for the bonusattaque field */
    private int bonusattaque;

    /** The value for the bonusdegat field */
    private int bonusdegat;

    /** The value for the bonusesquive field */
    private int bonusesquive;

    /** The value for the bonusvie field */
    private int bonusvie;

    /** The value for the bonuspa field */
    private int bonuspa;


    /**
     * Get the Nomobjet
     *
     * @return String
     */
    public String getNomobjet()
    {
        return nomobjet;
    }


    /**
     * Set the value of Nomobjet
     *
     * @param v new value
     */
    public void setNomobjet(String v) throws TorqueException
    {

        if (!ObjectUtils.equals(this.nomobjet, v))
        {
            this.nomobjet = v;
            setModified(true);
        }



        // update associated Objetdanspartie
        if (collObjetdansparties != null)
        {
            for (int i = 0; i < collObjetdansparties.size(); i++)
            {
                ((Objetdanspartie) collObjetdansparties.get(i))
                        .setNomobjet(v);
            }
        }
    }

    /**
     * Get the Description
     *
     * @return String
     */
    public String getDescription()
    {
        return description;
    }


    /**
     * Set the value of Description
     *
     * @param v new value
     */
    public void setDescription(String v) 
    {

        if (!ObjectUtils.equals(this.description, v))
        {
            this.description = v;
            setModified(true);
        }


    }

    /**
     * Get the Type
     *
     * @return String
     */
    public String getType()
    {
        return type;
    }


    /**
     * Set the value of Type
     *
     * @param v new value
     */
    public void setType(String v) 
    {

        if (!ObjectUtils.equals(this.type, v))
        {
            this.type = v;
            setModified(true);
        }


    }

    /**
     * Get the Duree
     *
     * @return int
     */
    public int getDuree()
    {
        return duree;
    }


    /**
     * Set the value of Duree
     *
     * @param v new value
     */
    public void setDuree(int v) 
    {

        if (this.duree != v)
        {
            this.duree = v;
            setModified(true);
        }


    }

    /**
     * Get the Bonusattaque
     *
     * @return int
     */
    public int getBonusattaque()
    {
        return bonusattaque;
    }


    /**
     * Set the value of Bonusattaque
     *
     * @param v new value
     */
    public void setBonusattaque(int v) 
    {

        if (this.bonusattaque != v)
        {
            this.bonusattaque = v;
            setModified(true);
        }


    }

    /**
     * Get the Bonusdegat
     *
     * @return int
     */
    public int getBonusdegat()
    {
        return bonusdegat;
    }


    /**
     * Set the value of Bonusdegat
     *
     * @param v new value
     */
    public void setBonusdegat(int v) 
    {

        if (this.bonusdegat != v)
        {
            this.bonusdegat = v;
            setModified(true);
        }


    }

    /**
     * Get the Bonusesquive
     *
     * @return int
     */
    public int getBonusesquive()
    {
        return bonusesquive;
    }


    /**
     * Set the value of Bonusesquive
     *
     * @param v new value
     */
    public void setBonusesquive(int v) 
    {

        if (this.bonusesquive != v)
        {
            this.bonusesquive = v;
            setModified(true);
        }


    }

    /**
     * Get the Bonusvie
     *
     * @return int
     */
    public int getBonusvie()
    {
        return bonusvie;
    }


    /**
     * Set the value of Bonusvie
     *
     * @param v new value
     */
    public void setBonusvie(int v) 
    {

        if (this.bonusvie != v)
        {
            this.bonusvie = v;
            setModified(true);
        }


    }

    /**
     * Get the Bonuspa
     *
     * @return int
     */
    public int getBonuspa()
    {
        return bonuspa;
    }


    /**
     * Set the value of Bonuspa
     *
     * @param v new value
     */
    public void setBonuspa(int v) 
    {

        if (this.bonuspa != v)
        {
            this.bonuspa = v;
            setModified(true);
        }


    }

       


    /**
     * Collection to store aggregation of collObjetdansparties
     */
    protected List collObjetdansparties;

    /**
     * Temporary storage of collObjetdansparties to save a possible db hit in
     * the event objects are add to the collection, but the
     * complete collection is never requested.
     */
    protected void initObjetdansparties()
    {
        if (collObjetdansparties == null)
        {
            collObjetdansparties = new ArrayList();
        }
    }


    /**
     * Method called to associate a Objetdanspartie object to this object
     * through the Objetdanspartie foreign key attribute
     *
     * @param l Objetdanspartie
     * @throws TorqueException
     */
    public void addObjetdanspartie(Objetdanspartie l) throws TorqueException
    {
        getObjetdansparties().add(l);
        l.setObjet((Objet) this);
    }

    /**
     * Method called to associate a Objetdanspartie object to this object
     * through the Objetdanspartie foreign key attribute using connection.
     *
     * @param l Objetdanspartie
     * @throws TorqueException
     */
    public void addObjetdanspartie(Objetdanspartie l, Connection con) throws TorqueException
    {
        getObjetdansparties(con).add(l);
        l.setObjet((Objet) this);
    }

    /**
     * The criteria used to select the current contents of collObjetdansparties
     */
    private Criteria lastObjetdanspartiesCriteria = null;

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getObjetdansparties(new Criteria())
     *
     * @return the collection of associated objects
     * @throws TorqueException
     */
    public List getObjetdansparties()
        throws TorqueException
    {
        if (collObjetdansparties == null)
        {
            collObjetdansparties = getObjetdansparties(new Criteria(10));
        }
        return collObjetdansparties;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Objet has previously
     * been saved, it will retrieve related Objetdansparties from storage.
     * If this Objet is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     *
     * @throws TorqueException
     */
    public List getObjetdansparties(Criteria criteria) throws TorqueException
    {
        if (collObjetdansparties == null)
        {
            if (isNew())
            {
               collObjetdansparties = new ArrayList();
            }
            else
            {
                criteria.add(ObjetdanspartiePeer.NOMOBJET, getNomobjet() );
                collObjetdansparties = ObjetdanspartiePeer.doSelect(criteria);
            }
        }
        else
        {
            // criteria has no effect for a new object
            if (!isNew())
            {
                // the following code is to determine if a new query is
                // called for.  If the criteria is the same as the last
                // one, just return the collection.
                criteria.add(ObjetdanspartiePeer.NOMOBJET, getNomobjet());
                if (!lastObjetdanspartiesCriteria.equals(criteria))
                {
                    collObjetdansparties = ObjetdanspartiePeer.doSelect(criteria);
                }
            }
        }
        lastObjetdanspartiesCriteria = criteria;

        return collObjetdansparties;
    }

    /**
     * If this collection has already been initialized, returns
     * the collection. Otherwise returns the results of
     * getObjetdansparties(new Criteria(),Connection)
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getObjetdansparties(Connection con) throws TorqueException
    {
        if (collObjetdansparties == null)
        {
            collObjetdansparties = getObjetdansparties(new Criteria(10), con);
        }
        return collObjetdansparties;
    }

    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Objet has previously
     * been saved, it will retrieve related Objetdansparties from storage.
     * If this Objet is new, it will return
     * an empty collection or the current collection, the criteria
     * is ignored on a new object.
     * This method takes in the Connection also as input so that
     * referenced objects can also be obtained using a Connection
     * that is taken as input
     */
    public List getObjetdansparties(Criteria criteria, Connection con)
            throws TorqueException
    {
        if (collObjetdansparties == null)
        {
            if (isNew())
            {
               collObjetdansparties = new ArrayList();
            }
            else
            {
                 criteria.add(ObjetdanspartiePeer.NOMOBJET, getNomobjet());
                 collObjetdansparties = ObjetdanspartiePeer.doSelect(criteria, con);
             }
         }
         else
         {
             // criteria has no effect for a new object
             if (!isNew())
             {
                 // the following code is to determine if a new query is
                 // called for.  If the criteria is the same as the last
                 // one, just return the collection.
                 criteria.add(ObjetdanspartiePeer.NOMOBJET, getNomobjet());
                 if (!lastObjetdanspartiesCriteria.equals(criteria))
                 {
                     collObjetdansparties = ObjetdanspartiePeer.doSelect(criteria, con);
                 }
             }
         }
         lastObjetdanspartiesCriteria = criteria;

         return collObjetdansparties;
     }











    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Objet is new, it will return
     * an empty collection; or if this Objet has previously
     * been saved, it will retrieve related Objetdansparties from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Objet.
     */
    protected List getObjetdanspartiesJoinObjet(Criteria criteria)
        throws TorqueException
    {
        if (collObjetdansparties == null)
        {
            if (isNew())
            {
               collObjetdansparties = new ArrayList();
            }
            else
            {
                criteria.add(ObjetdanspartiePeer.NOMOBJET, getNomobjet());
                collObjetdansparties = ObjetdanspartiePeer.doSelectJoinObjet(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(ObjetdanspartiePeer.NOMOBJET, getNomobjet());
            if (!lastObjetdanspartiesCriteria.equals(criteria))
            {
                collObjetdansparties = ObjetdanspartiePeer.doSelectJoinObjet(criteria);
            }
        }
        lastObjetdanspartiesCriteria = criteria;

        return collObjetdansparties;
    }









    /**
     * If this collection has already been initialized with
     * an identical criteria, it returns the collection.
     * Otherwise if this Objet is new, it will return
     * an empty collection; or if this Objet has previously
     * been saved, it will retrieve related Objetdansparties from storage.
     *
     * This method is protected by default in order to keep the public
     * api reasonable.  You can provide public methods for those you
     * actually need in Objet.
     */
    protected List getObjetdanspartiesJoinPartie(Criteria criteria)
        throws TorqueException
    {
        if (collObjetdansparties == null)
        {
            if (isNew())
            {
               collObjetdansparties = new ArrayList();
            }
            else
            {
                criteria.add(ObjetdanspartiePeer.NOMOBJET, getNomobjet());
                collObjetdansparties = ObjetdanspartiePeer.doSelectJoinPartie(criteria);
            }
        }
        else
        {
            // the following code is to determine if a new query is
            // called for.  If the criteria is the same as the last
            // one, just return the collection.
            criteria.add(ObjetdanspartiePeer.NOMOBJET, getNomobjet());
            if (!lastObjetdanspartiesCriteria.equals(criteria))
            {
                collObjetdansparties = ObjetdanspartiePeer.doSelectJoinPartie(criteria);
            }
        }
        lastObjetdanspartiesCriteria = criteria;

        return collObjetdansparties;
    }



        
    private static List fieldNames = null;

    /**
     * Generate a list of field names.
     *
     * @return a list of field names
     */
    public static synchronized List getFieldNames()
    {
        if (fieldNames == null)
        {
            fieldNames = new ArrayList();
            fieldNames.add("Nomobjet");
            fieldNames.add("Description");
            fieldNames.add("Type");
            fieldNames.add("Duree");
            fieldNames.add("Bonusattaque");
            fieldNames.add("Bonusdegat");
            fieldNames.add("Bonusesquive");
            fieldNames.add("Bonusvie");
            fieldNames.add("Bonuspa");
            fieldNames = Collections.unmodifiableList(fieldNames);
        }
        return fieldNames;
    }

    /**
     * Retrieves a field from the object by field (Java) name passed in as a String.
     *
     * @param name field name
     * @return value
     */
    public Object getByName(String name)
    {
        if (name.equals("Nomobjet"))
        {
            return getNomobjet();
        }
        if (name.equals("Description"))
        {
            return getDescription();
        }
        if (name.equals("Type"))
        {
            return getType();
        }
        if (name.equals("Duree"))
        {
            return new Integer(getDuree());
        }
        if (name.equals("Bonusattaque"))
        {
            return new Integer(getBonusattaque());
        }
        if (name.equals("Bonusdegat"))
        {
            return new Integer(getBonusdegat());
        }
        if (name.equals("Bonusesquive"))
        {
            return new Integer(getBonusesquive());
        }
        if (name.equals("Bonusvie"))
        {
            return new Integer(getBonusvie());
        }
        if (name.equals("Bonuspa"))
        {
            return new Integer(getBonuspa());
        }
        return null;
    }

    /**
     * Set a field in the object by field (Java) name.
     *
     * @param name field name
     * @param value field value
     * @return True if value was set, false if not (invalid name / protected field).
     * @throws IllegalArgumentException if object type of value does not match field object type.
     * @throws TorqueException If a problem occurs with the set[Field] method.
     */
    public boolean setByName(String name, Object value )
        throws TorqueException, IllegalArgumentException
    {
        if (name.equals("Nomobjet"))
        {
            // Object fields can be null
            if (value != null && ! String.class.isInstance(value))
            {
                throw new IllegalArgumentException("Invalid type of object specified for value in setByName");
            }
            setNomobjet((String) value);
            return true;
        }
        if (name.equals("Description"))
        {
            // Object fields can be null
            if (value != null && ! String.class.isInstance(value))
            {
                throw new IllegalArgumentException("Invalid type of object specified for value in setByName");
            }
            setDescription((String) value);
            return true;
        }
        if (name.equals("Type"))
        {
            // Object fields can be null
            if (value != null && ! String.class.isInstance(value))
            {
                throw new IllegalArgumentException("Invalid type of object specified for value in setByName");
            }
            setType((String) value);
            return true;
        }
        if (name.equals("Duree"))
        {
            if (value == null || ! (Integer.class.isInstance(value)))
            {
                throw new IllegalArgumentException("setByName: value parameter was null or not an Integer object.");
            }
            setDuree(((Integer) value).intValue());
            return true;
        }
        if (name.equals("Bonusattaque"))
        {
            if (value == null || ! (Integer.class.isInstance(value)))
            {
                throw new IllegalArgumentException("setByName: value parameter was null or not an Integer object.");
            }
            setBonusattaque(((Integer) value).intValue());
            return true;
        }
        if (name.equals("Bonusdegat"))
        {
            if (value == null || ! (Integer.class.isInstance(value)))
            {
                throw new IllegalArgumentException("setByName: value parameter was null or not an Integer object.");
            }
            setBonusdegat(((Integer) value).intValue());
            return true;
        }
        if (name.equals("Bonusesquive"))
        {
            if (value == null || ! (Integer.class.isInstance(value)))
            {
                throw new IllegalArgumentException("setByName: value parameter was null or not an Integer object.");
            }
            setBonusesquive(((Integer) value).intValue());
            return true;
        }
        if (name.equals("Bonusvie"))
        {
            if (value == null || ! (Integer.class.isInstance(value)))
            {
                throw new IllegalArgumentException("setByName: value parameter was null or not an Integer object.");
            }
            setBonusvie(((Integer) value).intValue());
            return true;
        }
        if (name.equals("Bonuspa"))
        {
            if (value == null || ! (Integer.class.isInstance(value)))
            {
                throw new IllegalArgumentException("setByName: value parameter was null or not an Integer object.");
            }
            setBonuspa(((Integer) value).intValue());
            return true;
        }
        return false;
    }

    /**
     * Retrieves a field from the object by name passed in
     * as a String.  The String must be one of the static
     * Strings defined in this Class' Peer.
     *
     * @param name peer name
     * @return value
     */
    public Object getByPeerName(String name)
    {
        if (name.equals(ObjetPeer.NOMOBJET))
        {
            return getNomobjet();
        }
        if (name.equals(ObjetPeer.DESCRIPTION))
        {
            return getDescription();
        }
        if (name.equals(ObjetPeer.TYPE))
        {
            return getType();
        }
        if (name.equals(ObjetPeer.DUREE))
        {
            return new Integer(getDuree());
        }
        if (name.equals(ObjetPeer.BONUSATTAQUE))
        {
            return new Integer(getBonusattaque());
        }
        if (name.equals(ObjetPeer.BONUSDEGAT))
        {
            return new Integer(getBonusdegat());
        }
        if (name.equals(ObjetPeer.BONUSESQUIVE))
        {
            return new Integer(getBonusesquive());
        }
        if (name.equals(ObjetPeer.BONUSVIE))
        {
            return new Integer(getBonusvie());
        }
        if (name.equals(ObjetPeer.BONUSPA))
        {
            return new Integer(getBonuspa());
        }
        return null;
    }

    /**
     * Set field values by Peer Field Name
     *
     * @param name field name
     * @param value field value
     * @return True if value was set, false if not (invalid name / protected field).
     * @throws IllegalArgumentException if object type of value does not match field object type.
     * @throws TorqueException If a problem occurs with the set[Field] method.
     */
    public boolean setByPeerName(String name, Object value)
        throws TorqueException, IllegalArgumentException
    {
      if (ObjetPeer.NOMOBJET.equals(name))
        {
            return setByName("Nomobjet", value);
        }
      if (ObjetPeer.DESCRIPTION.equals(name))
        {
            return setByName("Description", value);
        }
      if (ObjetPeer.TYPE.equals(name))
        {
            return setByName("Type", value);
        }
      if (ObjetPeer.DUREE.equals(name))
        {
            return setByName("Duree", value);
        }
      if (ObjetPeer.BONUSATTAQUE.equals(name))
        {
            return setByName("Bonusattaque", value);
        }
      if (ObjetPeer.BONUSDEGAT.equals(name))
        {
            return setByName("Bonusdegat", value);
        }
      if (ObjetPeer.BONUSESQUIVE.equals(name))
        {
            return setByName("Bonusesquive", value);
        }
      if (ObjetPeer.BONUSVIE.equals(name))
        {
            return setByName("Bonusvie", value);
        }
      if (ObjetPeer.BONUSPA.equals(name))
        {
            return setByName("Bonuspa", value);
        }
        return false;
    }

    /**
     * Retrieves a field from the object by Position as specified
     * in the xml schema.  Zero-based.
     *
     * @param pos position in xml schema
     * @return value
     */
    public Object getByPosition(int pos)
    {
        if (pos == 0)
        {
            return getNomobjet();
        }
        if (pos == 1)
        {
            return getDescription();
        }
        if (pos == 2)
        {
            return getType();
        }
        if (pos == 3)
        {
            return new Integer(getDuree());
        }
        if (pos == 4)
        {
            return new Integer(getBonusattaque());
        }
        if (pos == 5)
        {
            return new Integer(getBonusdegat());
        }
        if (pos == 6)
        {
            return new Integer(getBonusesquive());
        }
        if (pos == 7)
        {
            return new Integer(getBonusvie());
        }
        if (pos == 8)
        {
            return new Integer(getBonuspa());
        }
        return null;
    }

    /**
     * Set field values by its position (zero based) in the XML schema.
     *
     * @param position The field position
     * @param value field value
     * @return True if value was set, false if not (invalid position / protected field).
     * @throws IllegalArgumentException if object type of value does not match field object type.
     * @throws TorqueException If a problem occurs with the set[Field] method.
     */
    public boolean setByPosition(int position, Object value)
        throws TorqueException, IllegalArgumentException
    {
    if (position == 0)
        {
            return setByName("Nomobjet", value);
        }
    if (position == 1)
        {
            return setByName("Description", value);
        }
    if (position == 2)
        {
            return setByName("Type", value);
        }
    if (position == 3)
        {
            return setByName("Duree", value);
        }
    if (position == 4)
        {
            return setByName("Bonusattaque", value);
        }
    if (position == 5)
        {
            return setByName("Bonusdegat", value);
        }
    if (position == 6)
        {
            return setByName("Bonusesquive", value);
        }
    if (position == 7)
        {
            return setByName("Bonusvie", value);
        }
    if (position == 8)
        {
            return setByName("Bonuspa", value);
        }
        return false;
    }
     
    /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.
     *
     * @throws Exception
     */
    public void save() throws Exception
    {
        save(ObjetPeer.DATABASE_NAME);
    }

    /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.
     * Note: this code is here because the method body is
     * auto-generated conditionally and therefore needs to be
     * in this file instead of in the super class, BaseObject.
     *
     * @param dbName
     * @throws TorqueException
     */
    public void save(String dbName) throws TorqueException
    {
        Connection con = null;
        try
        {
            con = Transaction.begin(dbName);
            save(con);
            Transaction.commit(con);
        }
        catch(TorqueException e)
        {
            Transaction.safeRollback(con);
            throw e;
        }
    }

    /** flag to prevent endless save loop, if this object is referenced
        by another object which falls in this transaction. */
    private boolean alreadyInSave = false;
    /**
     * Stores the object in the database.  If the object is new,
     * it inserts it; otherwise an update is performed.  This method
     * is meant to be used as part of a transaction, otherwise use
     * the save() method and the connection details will be handled
     * internally
     *
     * @param con
     * @throws TorqueException
     */
    public void save(Connection con) throws TorqueException
    {
        if (!alreadyInSave)
        {
            alreadyInSave = true;



            // If this object has been modified, then save it to the database.
            if (isModified())
            {
                if (isNew())
                {
                    ObjetPeer.doInsert((Objet) this, con);
                    setNew(false);
                }
                else
                {
                    ObjetPeer.doUpdate((Objet) this, con);
                }
            }


            if (collObjetdansparties != null)
            {
                for (int i = 0; i < collObjetdansparties.size(); i++)
                {
                    ((Objetdanspartie) collObjetdansparties.get(i)).save(con);
                }
            }
            alreadyInSave = false;
        }
    }


    /**
     * Set the PrimaryKey using ObjectKey.
     *
     * @param key nomobjet ObjectKey
     */
    public void setPrimaryKey(ObjectKey key)
        throws TorqueException
    {
        setNomobjet(key.toString());
    }

    /**
     * Set the PrimaryKey using a String.
     *
     * @param key
     */
    public void setPrimaryKey(String key) throws TorqueException
    {
        setNomobjet(key);
    }


    /**
     * returns an id that differentiates this object from others
     * of its class.
     */
    public ObjectKey getPrimaryKey()
    {
        return SimpleKey.keyFor(getNomobjet());
    }
 

    /**
     * Makes a copy of this object.
     * It creates a new object filling in the simple attributes.
     * It then fills all the association collections and sets the
     * related objects to isNew=true.
     */
    public Objet copy() throws TorqueException
    {
        return copy(true);
    }

    /**
     * Makes a copy of this object using connection.
     * It creates a new object filling in the simple attributes.
     * It then fills all the association collections and sets the
     * related objects to isNew=true.
     *
     * @param con the database connection to read associated objects.
     */
    public Objet copy(Connection con) throws TorqueException
    {
        return copy(true, con);
    }

    /**
     * Makes a copy of this object.
     * It creates a new object filling in the simple attributes.
     * If the parameter deepcopy is true, it then fills all the
     * association collections and sets the related objects to
     * isNew=true.
     *
     * @param deepcopy whether to copy the associated objects.
     */
    public Objet copy(boolean deepcopy) throws TorqueException
    {
        return copyInto(new Objet(), deepcopy);
    }

    /**
     * Makes a copy of this object using connection.
     * It creates a new object filling in the simple attributes.
     * If the parameter deepcopy is true, it then fills all the
     * association collections and sets the related objects to
     * isNew=true.
     *
     * @param deepcopy whether to copy the associated objects.
     * @param con the database connection to read associated objects.
     */
    public Objet copy(boolean deepcopy, Connection con) throws TorqueException
    {
        return copyInto(new Objet(), deepcopy, con);
    }
  
    /**
     * Fills the copyObj with the contents of this object.
     * The associated objects are also copied and treated as new objects.
     *
     * @param copyObj the object to fill.
     */
    protected Objet copyInto(Objet copyObj) throws TorqueException
    {
        return copyInto(copyObj, true);
    }

  
    /**
     * Fills the copyObj with the contents of this object using connection.
     * The associated objects are also copied and treated as new objects.
     *
     * @param copyObj the object to fill.
     * @param con the database connection to read associated objects.
     */
    protected Objet copyInto(Objet copyObj, Connection con) throws TorqueException
    {
        return copyInto(copyObj, true, con);
    }
  
    /**
     * Fills the copyObj with the contents of this object.
     * If deepcopy is true, The associated objects are also copied
     * and treated as new objects.
     *
     * @param copyObj the object to fill.
     * @param deepcopy whether the associated objects should be copied.
     */
    protected Objet copyInto(Objet copyObj, boolean deepcopy) throws TorqueException
    {
        copyObj.setNomobjet(nomobjet);
        copyObj.setDescription(description);
        copyObj.setType(type);
        copyObj.setDuree(duree);
        copyObj.setBonusattaque(bonusattaque);
        copyObj.setBonusdegat(bonusdegat);
        copyObj.setBonusesquive(bonusesquive);
        copyObj.setBonusvie(bonusvie);
        copyObj.setBonuspa(bonuspa);

        copyObj.setNomobjet((String)null);

        if (deepcopy)
        {


        List vObjetdansparties = getObjetdansparties();
        if (vObjetdansparties != null)
        {
            for (int i = 0; i < vObjetdansparties.size(); i++)
            {
                Objetdanspartie obj = (Objetdanspartie) vObjetdansparties.get(i);
                copyObj.addObjetdanspartie(obj.copy());
            }
        }
        else
        {
            copyObj.collObjetdansparties = null;
        }
        }
        return copyObj;
    }
        
    
    /**
     * Fills the copyObj with the contents of this object using connection.
     * If deepcopy is true, The associated objects are also copied
     * and treated as new objects.
     *
     * @param copyObj the object to fill.
     * @param deepcopy whether the associated objects should be copied.
     * @param con the database connection to read associated objects.
     */
    protected Objet copyInto(Objet copyObj, boolean deepcopy, Connection con) throws TorqueException
    {
        copyObj.setNomobjet(nomobjet);
        copyObj.setDescription(description);
        copyObj.setType(type);
        copyObj.setDuree(duree);
        copyObj.setBonusattaque(bonusattaque);
        copyObj.setBonusdegat(bonusdegat);
        copyObj.setBonusesquive(bonusesquive);
        copyObj.setBonusvie(bonusvie);
        copyObj.setBonuspa(bonuspa);

        copyObj.setNomobjet((String)null);

        if (deepcopy)
        {


        List vObjetdansparties = getObjetdansparties(con);
        if (vObjetdansparties != null)
        {
            for (int i = 0; i < vObjetdansparties.size(); i++)
            {
                Objetdanspartie obj = (Objetdanspartie) vObjetdansparties.get(i);
                copyObj.addObjetdanspartie(obj.copy(con), con);
            }
        }
        else
        {
            copyObj.collObjetdansparties = null;
        }
        }
        return copyObj;
    }
    
    

    /**
     * returns a peer instance associated with this om.  Since Peer classes
     * are not to have any instance attributes, this method returns the
     * same instance for all member of this class. The method could therefore
     * be static, but this would prevent one from overriding the behavior.
     */
    public ObjetPeer getPeer()
    {
        return peer;
    }

    /**
     * Retrieves the TableMap object related to this Table data without
     * compiler warnings of using getPeer().getTableMap().
     *
     * @return The associated TableMap object.
     */
    public TableMap getTableMap() throws TorqueException
    {
        return ObjetPeer.getTableMap();
    }


    public String toString()
    {
        StringBuffer str = new StringBuffer();
        str.append("Objet:\n");
        str.append("Nomobjet = ")
           .append(getNomobjet())
           .append("\n");
        str.append("Description = ")
           .append(getDescription())
           .append("\n");
        str.append("Type = ")
           .append(getType())
           .append("\n");
        str.append("Duree = ")
           .append(getDuree())
           .append("\n");
        str.append("Bonusattaque = ")
           .append(getBonusattaque())
           .append("\n");
        str.append("Bonusdegat = ")
           .append(getBonusdegat())
           .append("\n");
        str.append("Bonusesquive = ")
           .append(getBonusesquive())
           .append("\n");
        str.append("Bonusvie = ")
           .append(getBonusvie())
           .append("\n");
        str.append("Bonuspa = ")
           .append(getBonuspa())
           .append("\n");
        return(str.toString());
    }
}
